package com.lzy.crm.service.impl;

import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.lzy.crm.base.mybatis.BaseMapper;
import com.lzy.crm.base.mybatis.Example;
import com.lzy.crm.base.page.PageQuery;
import com.lzy.crm.base.service.BaseServiceImpl;
import com.lzy.crm.dao.ControlMapper;
import com.lzy.crm.dao.criteria.ControlCriteria;
import com.lzy.crm.domain.Control;
import com.lzy.crm.service.ControlService;

@Service
public class ControlServiceImpl extends BaseServiceImpl<Control, ControlCriteria> implements ControlService{
	
	
	@Resource
	private ControlMapper controlMapper;
	
	@Override
	public BaseMapper<Control, ControlCriteria> getBaseMapper() {
		return controlMapper;
	}

	
	/**
	 * 查询列表信息
	 * @param gameId 玩家ID
	 * @param kindId 充值ID
	 * @return
	 */
	public List<Control> getControlList(String gameId,String kindId,PageQuery pageQuery){
		
		return controlMapper.getControlList(gameId, kindId, pageQuery);
	}
	
	/**
	 * 查询控制器信息
	 * @param gameId
	 * @param kindId
	 * @return
	 */
	public Control getControl(String gameId,String kindId){
		Example<ControlCriteria> example = new Example<ControlCriteria>(ControlCriteria.class);
		ControlCriteria controlCriteria = example.createCriteria();
		controlCriteria.andGameIdEqualTo(gameId);
		controlCriteria.andKindIdEqualTo(kindId);
		return controlMapper.getObjectByExample(example);
	}
	
	
}